﻿using DevLegancy.Bussines;
using DevLegancy.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace DevLegancy.Controllers
{
    public class HomeController : Controller
    {
        #region MyRegion
         BussinesManager _bussines = new BussinesManager();
        #endregion
        public ActionResult Index(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                if(id == "ct")
                    ViewBag.Message = "Prueba Contactenos";
            }
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }

        #region Contactenos
        
        /// <summary>
        /// Pagina de Contactenos
        /// </summary>
        /// <returns></returns>
        public ActionResult Contact_us()
        {
            return View();
        }

        /// <summary>
        /// Pagina de Contactenos
        /// </summary>
        /// <returns></returns>
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult GuardarContactenos(FormCollection form)
        {           
            ContactoModel contactoModel = new ContactoModel();
            contactoModel.Nombre = form["txt_Nombre"];
            contactoModel.Telefono = (form["txt_Telefono"].Length);
            contactoModel.Email = form["txt_Email"];
            contactoModel.Mensaje = form["TxtArea_Msje"];
            
            this._bussines.GuardarContacto(contactoModel);

            return RedirectToRoute("Default", new { controller = "Home", action = "Index", id = "ct" });          
        }

        public ActionResult Guardar()
        {
            return View();
        }
        #endregion

        #region Quienes Somos

        /// <summary>
        /// Pagina de Informacion general de Devlegancy SAS
        /// </summary>
        /// <returns></returns>
        public ActionResult CompanyInfo()
        {
            return View();
        }

        #endregion

        #region Servicios

        /// <summary>
        /// Pagina de Servicios
        /// </summary>
        /// <returns></returns>
        public ActionResult Services()
        {
            return View();
        }

        #endregion

        #region Clientes

        /// <summary>
        /// Pagina de Clientes
        /// </summary>
        /// <returns></returns>
        public ActionResult Clients()
        {
            return View();
        }

        #endregion
    }
}
